-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[R4R]reannounce local pending transactions #570
Merged
Merged
+259
−15
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unclezoro
changed the title
reannouce local pending transactions
[WIP]reannouce local pending transactions
Nov 21, 2021
keefel
changed the title
[WIP]reannouce local pending transactions
reannouce local pending transactions
Nov 22, 2021
keefel
changed the title
reannouce local pending transactions
reannounce local pending transactions
Nov 22, 2021
keefel
changed the title
reannounce local pending transactions
[R4R]reannounce local pending transactions
Nov 24, 2021
unclezoro
reviewed
Nov 24, 2021
cmd/utils/flags.go
Outdated
@@ -398,6 +398,11 @@ var ( | |||
Usage: "Maximum amount of time non-executable transaction are queued", | |||
Value: ethconfig.Defaults.TxPool.Lifetime, | |||
} | |||
TxPoolReannounceTimeFlag = cli.DurationFlag{ | |||
Name: "txpool.reannouncetime", | |||
Usage: "Minimum amount of time for announcing local pending transactions again", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minimum amount of time
sound weried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
unclezoro
approved these changes
Nov 24, 2021
yutianwu
approved these changes
Nov 24, 2021
j75689
reviewed
Nov 24, 2021
j75689
approved these changes
Nov 24, 2021
j75689
pushed a commit
that referenced
this pull request
Nov 29, 2021
* reannouce local pending transactions * add tests for tx_pool reannouce local pending transactions * add tests for handler reannounce local pending transactions
This was referenced Dec 12, 2021
keefel
added a commit
to keefel/bsc
that referenced
this pull request
Jun 6, 2022
* reannouce local pending transactions * add tests for tx_pool reannouce local pending transactions * add tests for handler reannounce local pending transactions
This was referenced Jun 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When the network traffic is heavy, transactions that have been broadcast may be truncated in peers' tx_pools, while these local pending transactions have been marked as known, the source node won't broadcast them again, so they have no chance to be mined.
We add a timer to check whether the local pending transactions stay in tx_pool exceed a threshold, once transactions exceed the threshold, they will be announced to some peers again. The TxPool.ReannounceTime is used to control the threshold, the default value of TxPool.ReannounceTime is too big to be exceeded, users can config this parameter to enable this feature.
Also need to pay attention, this feature only announce the local pending transactions. If your node is configured TxPool.NoLocals=false, then the transactions sent to this RPC node will be treated as local transactions, otherwise you should add your addresses to the TxPool.Locals, only the transactions from the local addresses will be treated as local transactions.
Rationale
This feature is introduced to handle some extreme situations, it won't affect the original function, and it is disabled by default. Users can enable this feature by setting TxPool.ReannouceTime according to their needs.
Example
Set TxPool.ReannounceTime to 5 minutes:
geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --txpool.reannouncetime 5m
Changes
Notable changes: